﻿@using Digital.WCFClient.ConfigService
@using System.Collections.ObjectModel
@using Digital.Common.Mvc.Extensions
@using Digital.Web.Controllers
@using Microsoft.AspNet.Identity
@using Digital.Common.Utilities
@{
    ViewBag.Title = "专利管理";
    Layout = "~/Views/Shared/_LayoutDigital.cshtml";
}
@section PageSpecificJavascriptIncludes{
<link rel="stylesheet" href="../DigitalStyle/css/jquery.gritter.css" />

<script src="../DigitalStyle/js/jquery.gritter.min.js"></script>
<script src="../DigitalStyle/js/jquery.validate.min.js"></script>
<script src="../DigitalStyle/js/JqueryToken.js"></script>
<script src="../DigitalStyle/js/messages_cn.js"></script>

}

<div class="pageheader">
    <h2><i class="fa fa-user"></i> 专利管理 <span>专利中心</span></h2>
    <div class="breadcrumb-wrapper">
        <span class="label">你的位置:</span>
        <ol class="breadcrumb">
            <li><a href="">企业中心</a></li>
            <li class="active">企业专利</li>
        </ol>
    </div>
</div>

<div class="contentpanel">
    <div class="row">

        <div class="btn-group mr10">
            <button class="btn btn-white" type="button"  onclick="CheckAll()"><i class="fa fa-check mr5"></i> 全选</button>
            @*<button class="btn btn-white" type="button"><i class="fa fa-minus-square mr5"></i> 取消</button>*@
        </div>

        <div class="btn-group mr10">
            <button class="btn btn-success" onclick="javascript: window.location = 'CompanyPatentAdd'" type="button"><i class="fa fa-pencil mr5"></i>发布专利</button>
            <button class="btn btn-danger" onclick="javascript:Deletes()" type="button"><i class="fa fa-trash-o mr5"></i> 删除专利</button>
        </div>

        <div class="btn-group mr10">
            @*<button class="btn btn-warning" type="button"><i class="fa fa-external-link mr5"></i> 更改浏览权限</button>*@
        </div>

        @Html.AntiForgeryToken()
        <div class="table-responsive">
            <table class="table table-primary table-buglist">
                <thead>
                    <tr>
                        <th>排序</th>
                        <th>选择</th>
                        @*<th>权限</th>*@
                        <th>专利名称/专利号</th>
                        <th>技术领域</th>
                        <th>是否转让</th>
                        <th>发布时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    @{
                        if (ViewBag.PatentList != null)
                        {
                            var StringTransferred = "否";
                            foreach (var PatentMode in (List<PatentModel>)ViewBag.PatentList)
                            {
                                StringTransferred = PatentMode.IsTransferred ? "是" : "否";
                                <tr>
                                    <td>@PatentMode.PatentOrderID</td>
                                    <td><input type="checkbox" name="IdCheck" value="@PatentMode.PatentID"  /></td>
                                    @*<td><a href="view-issue.html">所有人可浏览</a></td>*@
                                    <td>
                                        @PatentMode.PatentName<br />@PatentMode.PatentNumber
                                    </td>
                                    <td>@PatentMode.PatentTechnologyDomain</td>
                                    <td>@StringTransferred</td>
                                    <td>@PatentMode.PatentDate</td>
                                    <td>
                                        <div class="btn-group">
                                            <a data-toggle="dropdown" class="dropdown-toggle">
                                                <i class="fa fa-cog"></i>
                                            </a>
                                            <ul role="menu" class="dropdown-menu pull-right">
                                                <li><a href="CompanyPatentAdd?Id=@PatentMode.PatentID">编辑</a></li>
                                                <li><a href="javascript:Delete(@PatentMode.PatentID)">删除</a></li>
                                                
                                            </ul>
                                        </div>

                                    </td>
                                </tr>
                            }
                        }

                    }

                </tbody>
            </table>
        </div>

    </div>
</div>

<script>
    jQuery(document).ready(function () {

        // Delete row in a table
        jQuery('.delete-row').click(function () {
            var c = confirm("Continue delete?");
            if (c)
                jQuery(this).closest('tr').fadeOut(function () {
                    jQuery(this).remove();
                });

            return false;
        });

        // Show aciton upon row hover
        jQuery('.table-hidaction tbody tr').hover(function () {
            jQuery(this).find('.table-action-hide a').animate({ opacity: 1 });
        }, function () {
            jQuery(this).find('.table-action-hide a').animate({ opacity: 0 });
        });

    });

    function callBack() {
        window.location = window.location;
    }

    function CheckAll()
    {
        $.jsparams.checkAll("IdCheck");
    }

    function Deletes()
    {
        var Ids = $.jsparams.checkByName("IdCheck");
        ComAjax("/Company/CompanyPatentDeletes", { Ids: Ids }, "专利删除", "callBack");
    }

    function Delete(Id) {
        ComAjax("/Company/CompanyPatentDelete", { Id: Id }, "专利删除", "callBack");
    }
</script>







